<template>
  <el-dialog
    title="详情"
    :visible="visible"
    :append-to-body="true"
    @close="handleDialogClose"
    width="700px"
  >
    <img :src="data" />
    <div slot="footer">
      <el-button @click="visible = false">取 消</el-button>
      <el-button type="primary" @click="visible = false">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  props: {
    show: {
      type: Boolean,
      required: true,
      default: () => false
    },
    data: {
      type: String,
      required: true,
      default: () => ''
    }
  },
  data() {
    return {
      visible: false
    }
  },
  methods: {
    // 处理Dialog关闭事件
    handleDialogClose() {
      this.$emit('update:show')
    }
  },
  watch: {
    show(value) {
      this.visible = value
    }
  }
}
</script>

<style lang="stylus" scoped>
img
  width 100%
  height 100%
</style>
